SELECT
<#assign prefixName=' '>
<#if (select__beginDate??)>
${prefixName} T.BEGIN_DATE AS beginDate
	<#assign prefixName=','>
</#if>
<#if (select__endDate??)>
${prefixName} T.END_DATE AS endDate
	<#assign prefixName=','>
</#if>
<#if (select__id??)>
${prefixName} T.ID AS id
	<#assign prefixName=','>
</#if>
<#if (select__orgId??)>
${prefixName} T.ORG_ID AS orgId
	<#assign prefixName=','>
</#if>
<#if (select__userGroupId??)>
${prefixName} T.USER_GROUP_ID AS userGroupId
	<#assign prefixName=','>
</#if>
<#if prefixName == ' '>
  T.BEGIN_DATE AS beginDate
, T.END_DATE AS endDate
, T.ID AS id
, T.ORG_ID AS orgId
, T.USER_GROUP_ID AS userGroupId
</#if>
FROM C1_US_GROUP_ORG T
<#include "whereByCode.ftl">
<#assign prefixName='ORDER BY'>
<#if (order__by__beginDate??)>
${prefixName} T.BEGIN_DATE ${order__by__beginDate__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__endDate??)>
${prefixName} T.END_DATE ${order__by__endDate__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__id??)>
${prefixName} T.ID ${order__by__id__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__orgId??)>
${prefixName} T.ORG_ID ${order__by__orgId__value!}
	<#assign prefixName=','>
</#if>
<#if (order__by__userGroupId??)>
${prefixName} T.USER_GROUP_ID ${order__by__userGroupId__value!}
	<#assign prefixName=','>
</#if>
